﻿//
// Copyright (c) 2024 BPer
//
#ifndef INCLUDE_BPERSTREAM_BPERSTREAMMANAGER1_H_
#define INCLUDE_BPERSTREAM_BPERSTREAMMANAGER1_H_
#include <bperstream/BPerStreamType.h>
#include <bperstream/BPerSynBuffer.h>
#include <bperstream/BPerSynBufferManager.h>
#include <vector>

class BPerStreamStateNotify{
public:
	BPerStreamStateNotify(){};
	virtual ~BPerStreamStateNotify(){};
    virtual void streamStateNotify(int32_t puid,BPerRtcDirection opt,bool isConnect)=0;
};

class BPerStreamManager {
public:
	BPerStreamManager(BPerSynBufferManager* synMgr);
	virtual ~BPerStreamManager();

public:
	BPerStreamStateNotify* m_streamState;


	int32_t getPlayOnlineCount();
	int32_t getPushOnlineCount();
	void connectNotify(int32_t puid,BPerRtcDirection opt,bool isConnect);

public:
	void setMediaConfig(int32_t puid,BPerAudioParam* audio,BPerVideoParam* video);
	void sendRequest(int32_t puid,uint32_t ssrc,BPerRequestType req);

	void setSendRequestCallback(BPerSendRequestCallback* request);
	void setDecoderMediaConfigCallback(BPerMediaConfigCallback* dec);
	void setRenderMediaConfigCallback(BPerMediaConfigCallback* render);

	int32_t getAudioClock();
	int32_t getVideoClock();
private:
	BPerSendRequestCallback* m_sendRequestCb;
	BPerMediaConfigCallback* m_mediaConfig_dec;
	BPerMediaConfigCallback* m_mediaConfig_render;
	BPerSynBufferManager* m_synMgr;
	int32_t m_videoClock;
	int32_t m_audioClock;
private:

	std::vector<int32_t> m_onlinePlayUsers;
	std::vector<int32_t> m_onlinePushUsers;
};

#endif /* INCLUDE_BPERSTREAM_BPERSTREAMMANAGER_H_ */
